package gameos.core.graphics;

import gameos.core.GameOS;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;

public class FreeFontTypeTool {
	
	public BitmapFont normalFont;
	
	public GameOS game;	
	
	public FreeFontTypeTool(GameOS game)
	{
		this.game = game;
	}
	
	public void loadFont()
	{
		if(normalFont == null){			
			FileHandle fontFile = Gdx.files.internal("data/Magnum.TTF");
			FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);	
			String chars="AÁẠÃÀẢĂẲẮẰẴẶÂẨẤẦẪẬBCDĐEẺÉÈẼẸÊỂẾỀỄỆGHIỈÍÌĨỊKLMNOỎÓÒÕỌÔỔỐỒỖỘƠỞỚỜỠỢPQRSTUỦÚÙŨỤƯỬỨỪỮỰVXYJWZaảáàãạăẳắằẵặâẩấầẫậbcdđeẻéèẽẹêểếềễệghiỉíìĩịklmnoỏóòõọôổốồỗộơởớờỡợpqrstuủúùũụưửứừữựvxyỷýỳỹỵfjwz0123456789\"!`?'.,;:()[]{}<>|/@\\^$-%+=#_&~*";
			float scale = game.screenInfo.scaleX;						
			FreeTypeBitmapFontData fontData = generator.generateData((int)(Math.ceil(40*scale)), chars, false);
			generator.dispose();			
			normalFont = new BitmapFont(fontData, fontData.getTextureRegion(), false);
		}
	}
}
